//
//  RigisterViewController.m
//  Socrates
//
//  Created by shy on 15/3/10.
//  Copyright (c) 2015年 shy. All rights reserved.
//

#import "RegisterViewController.h"
#import "SecondRegistViewController.h"
#import "MainViewController.h"

typedef enum {
    kRigister_mobile_item = 0,
    kRigister_verify_code_item,
    kRigister_login_code_item,
    kRigister_login_code_verify_item,
} RigisterItems;

@interface RegisterViewController ()<UITextFieldDelegate> {
    UITextField *mobile_;
    UITextField *verifyCode_;
    UITextField *loginCode_;
    UITextField *loginVerify_;
    UIView *background_;
    UIButton *next_;
}

@end

@implementation RegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:239/255. green:239/255. blue:244/255. alpha:1.];
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    CGFloat topMargin = 90.;
    CGFloat gapHeight = 40.;
    CGFloat lineHeight = 1.;
    background_ = [[UIView alloc] initWithFrame:CGRectMake(0, topMargin, width, gapHeight*4)];
    background_.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:background_];
    UIColor *lineColor = [UIColor colorWithRed:207/255. green:207/255. blue:207/255. alpha:0.8];
    UIView *separateLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 1)];
    separateLine.backgroundColor = lineColor;
    [self.view addSubview:separateLine];
    mobile_ = [[UITextField alloc] initWithFrame:CGRectMake(20, 0, width - 40, gapHeight)];
    mobile_.placeholder = NSLocalizedString(@"$$$insert_phone_number", nil);
    [background_ addSubview:mobile_];
    UIView *separateLineA = [[UIView alloc] initWithFrame:CGRectMake(20, gapHeight, width - 40, lineHeight)];
    separateLineA.backgroundColor = lineColor;
    [background_ addSubview:separateLineA];
    
    verifyCode_ = [[UITextField alloc] initWithFrame:CGRectMake(20, gapHeight, width - 40, gapHeight)];
    verifyCode_.placeholder = NSLocalizedString(@"$$$insert_code", nil);
    [background_ addSubview:verifyCode_];
    UIView *separateLineB = [[UIView alloc] initWithFrame:CGRectMake(20, gapHeight*2, width - 40, lineHeight)];
    separateLineB.backgroundColor = lineColor;
    [background_ addSubview:separateLineB];
    
    loginCode_ = [[UITextField alloc] initWithFrame:CGRectMake(20, gapHeight*2, width - 40, gapHeight)];
    loginCode_.placeholder = NSLocalizedString(@"$$$insert_password", nil);
    [background_ addSubview:loginCode_];
    UIView *separateLineC = [[UIView alloc] initWithFrame:CGRectMake(20, gapHeight*3, width - 40, lineHeight)];
    separateLineC.backgroundColor = lineColor;
    [background_ addSubview:separateLineC];
    
    loginVerify_ = [[UITextField alloc] initWithFrame:CGRectMake(20, gapHeight*3, width - 40, gapHeight)];
    loginVerify_.placeholder = NSLocalizedString(@"$$$confirm_password", nil);
    [background_ addSubview:loginVerify_];
    UIView *separateLineD = [[UIView alloc] initWithFrame:CGRectMake(0, topMargin + gapHeight*4, width, lineHeight)];
    separateLineD.backgroundColor = lineColor;
    [self.view addSubview:separateLineD];
    
    next_ = [[UIButton alloc] initWithFrame:CGRectMake((width - 120)/2, topMargin + gapHeight*4 + 45, 120, 35)];
    [next_ setImage:[UIImage imageNamed:@"next"] forState:UIControlStateNormal];
    [next_ addTarget:self action:@selector(clickNext) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:next_];
}

- (void)clickNext {
    SecondRegistViewController *srvc = [[SecondRegistViewController alloc] init];
    [self.navigationController pushViewController:srvc animated:YES];
}

@end